package com.zxg.zbc.biz.manager;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.zxg.weixin.api.service.domain.WeixinUnifiedOrderResponse;
import com.zxg.zbc.biz.exception.ManagerException;
import com.zxg.zbc.dal.dataobject.PayServiceItem;
import com.zxg.zbc.dal.dataobject.User;
import com.zxg.zbc.dal.dataobject.UserAlipayTrade;

public interface PayServiceManager {

  final static Logger  log                  = LoggerFactory.getLogger(PayServiceManager.class);

  public static String WEIXIN_YOUFEI_NOTIFY = "http://media.zhixiangge.com/weixinNotify";

  /**
   * 根据用户和购买项生成本地订单和支付url
   * 
   * @param item
   * @param user
   * @return
   */
  public UserAlipayTrade generateAlipayFeeUrl(PayServiceItem item, User user) throws ManagerException;

  public WeixinUnifiedOrderResponse generateWeixinUnifiedOrder(PayServiceItem item, User user, String openId, String ip) throws ManagerException;

  public String generateYoufeiAlipayUrl(Long billId, String fee, User user) throws ManagerException;

  public Map<String, String> generateYoufeiAlipayUrlWeixin(Long billId, String fee, User user, String openId, String ip) throws ManagerException;

  public UserAlipayTrade generatePayResult(Boolean success, String out_trade_no, String trade_no, String trade_status, String buyer_email, String totalFee)
      throws ManagerException;

  public List<UserAlipayTrade> getTradesByUserId(User user) throws ManagerException;

 

  /**
   * 阿里支付回调结果处理
   * 
   * @param succeed
   *          true | false
   * @param alipayId
   *          用户余额记录变动表里对应的outer_id
   * @return
   * @throws ManagerException
   */
  public boolean handleAlipayResult(boolean succeed, String ourTradeId, String alipayTradeNo, String tradeStatus, String buyeAlipayEmail, String totalFee) throws ManagerException;
}
